import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

const routes = [
    {
        path: '/',
        name: 'Layout',
        component: () => import('@/layout/index'),
        redirect: '/dashboard',
        children: [
            {
                path: 'dashboard',
                name: 'Dashboard',
                component: ()=>import('@/views/Dashboard.vue'),
                meta: {title: '首页'}
            },
            {
                path: 'profile',
                name: 'Profile',
                component: ()=>import('@/views/Profile.vue'),
                meta: {title: '个人中心'}
            },
        ]
    },
    {
        path: '/system',
        name: 'System',
        component: () => import('@/layout/index'),
        meta:{title:'系统管理'},
        children: [
            {
                path: 'user',
                name: 'User',
                component: ()=>import('@/views/system/User.vue'),
                meta: {title: '系统用户管理'}
            },
            {
                path: 'block',
                name: 'Block',
                component: ()=>import('@/views/system/Block.vue'),
                meta: {title: '系统板块管理'}
            }
        ]
    },
    {
        path: '/info',
        name: 'Info',
        component: () => import('@/layout/index'),
        meta:{title:'主要管理'},
        children: [
            {
                path: 'user',
                name: 'User',
                component: ()=>import('@/views/info/AppUser.vue'),
                meta: {title: '用户管理'}
            },
            {
                path: 'media',
                name: 'Media',
                meta:{title:'资源管理'},
                component: { render: h => h('router-view') },
                children: [
                    {
                        path: 'novel',
                        name: 'Novel',
                        component: ()=>import('@/views/info/media/Novel.vue'),
                        meta: {title: '小说管理'},
                    },
                    {
                        path: 'mediaNovel',
                        name: 'MediaNovel',
                        component: ()=>import('@/views/info/media/MediaNovel.vue'),
                        meta: {title: '小说章节管理'}
                    },
                    {
                        path: 'comic',
                        name: 'Comic',
                        component: ()=>import('@/views/info/media/Comic.vue'),
                        meta: {title: '漫画管理'}
                    },
                    {
                        path: 'mediaComic',
                        name: 'MediaComic',
                        component: ()=>import('@/views/info/media/MediaComic.vue'),
                        meta: {title: '漫画章节管理'}
                    },
                    {
                        path: 'video',
                        name: 'Video',
                        component: ()=>import('@/views/info/media/Video.vue'),
                        meta: {title: '视频管理'}
                    },
                    {
                        path: 'mediaVideo',
                        name: 'MediaVideo',
                        component: ()=>import('@/views/info/media/MediaVideo.vue'),
                        meta: {title: '视频资源管理'}
                    },
                ]
            }
        ]
    },
    {
        path: '/educational',
        name: 'Educational',
        component: () => import('@/layout/index'),
        meta:{title:'教务管理'},
        children: [
            {
                path: 'assigned',
                name: 'Assigned',
                component: ()=>import('@/views/educational/Assigned.vue'),
                meta: {title: '课程安排'}
            },
            {
                path: 'attendance',
                name: 'Attendance',
                component: ()=>import('@/views/educational/Attendance.vue'),
                meta: {title: '考勤记录'}
            },
        ]
    },
    {
        path:'/login',
        name:'Login',
        component:()=>import('@/views/Login.vue'),
    }
];

export default new Router({
    
    mode: 'history', 
    routes: routes
})